package com.usain.service.impl;

import com.usain.mapper.TeacherMapper;
import com.usain.pojo.Teacher;
import com.usain.service.TeacerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class  TeacherServiceImpl implements TeacerService {
    @Autowired
    private TeacherMapper teacherMapper;
    @Override
    public List<Teacher> findTeacher() {

        return teacherMapper.selectAll();
    }

    @Override
    public void AddTeacher(Teacher teacher) {
        teacherMapper.insert(teacher);
    }

    @Override
    public Teacher findById(Integer id) {
        return teacherMapper.findById(id);
    }

    @Override
    public void Update(Teacher teacher) {
        teacherMapper.updateByPrimaryKey(teacher);
    }

    @Override
    public void Delete(Integer id) {
        teacherMapper.deleteByPrimaryKey(id);
    }
}
